import { TOKEN_KEY } from '@/constants'
import Cookies from 'js-cookie'

// export const getToken = () => {
//   return localStorage.getItem(TOKEN_KEY)
// }

// export const setToken = (token: string) => {
//   localStorage.setItem(TOKEN_KEY, token)
// }

// export const removeToken = () => {
//   localStorage.removeItem(TOKEN_KEY)
// }


// 封装cookie来持久化存储token

// 获取token
export const getLocalToken=()=>{
  return Cookies.get(TOKEN_KEY)
}

// 设置token
export const setLocalToken=(token:string)=>{
  return Cookies.set(TOKEN_KEY,token)
}
// 
// 删除方法
export const removeLocalToken = () => {
  Cookies.remove(TOKEN_KEY)
}